﻿// Show a pop up in the center of the screen
function PopupCenter(pageURL, title, w, h, refreshOnUnload) {

    var left = (screen.width / 2) - (w / 2);
    var top = (screen.height / 2) - (h / 2);
    var targetWin = window.open(pageURL, title,
                'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w +
                ', height=' + h + ', top=' + top + ', left=' + left);

    // If needs to refresh parent after unload
    if (refreshOnUnload) {
        targetWin.onload = function () {
            targetWin.onunload = function () {
                location.reload();
            };
        }
    }
}
